<!-- 通知详情 -->
<template>
    <div class="notice-details">
		<h3 v-html="details1.title"></h3>
		<div class="msg">
			<span>发布部门：{{details1.publishOrgName}}</span>
			<span>发布人:{{details1.author}} </span>
		</div>
		<div class="msg">起止日期：{{details1.startTime}} 至 {{details1.endTime}} </div>
		<div class="details" v-html="details1.content" style="white-space: pre-wrap;"></div>
		<div class="file-box" v-if="fileList.length>0">
			<h4>附件</h4>
			<a class="file" :download="fItem.title" v-for="(fItem,index) in fileList" :href="fItem.content">{{index+1}}：{{fItem.title}}</a>
		</div>
    </div>
</template>

<script>
export default {
  name: 'NoticeDetails',
  data () {
    return {
    	id:this.$route.query.uuid,
    	fileList:[],
    	details1:{},
    }
  },
  methods:{
  	//获取通知公告
    getNotice(){
    	let _self = this;
    	let userPhone = window.localStorage.getItem('loginTel');
    	let uri = 'noticeMessage/main/getNoticeBy/'+ _self.id;
    	_self.$_get( uri , { 'userPhone':userPhone, })
  		.then(function(res) {
  			let data = res;
            _self.details1 = data;
			//附件
			let str = _self.details1.attachment;
			if(str!=''){
				let attachment = str.split(',');
				attachment.map(function(aitem,aindex){
					let singleItem = {
						content: aitem.split(';')[0],
						title: aitem.split(';')[1],
					}
					_self.fileList.push(singleItem)
				})
			}
	        _self.$forceUpdate();
  		})
    },
  },
  mounted(){
  	this.getNotice();
  	dd.ready(function(){
        dd.biz.navigation.setTitle({
            title: '公告详情',//标题
            onSuccess : function(result) {},
            onFail : function() {}
        });
    }) 
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less">
	.notice-details{
		height:100%;
		background:#fff;
		overflow-y:auto;
		padding-top:20px;
		h3{
			width:100%;
			min-height:120px;
			line-height:50px;
			padding:20px 40px;
			box-sizing:border-box;
			color:#333;
			font-size:32px;
		}
		div.msg{
			padding:0 30px;
			font-size:24px; /* px */
			line-height:40px;
			color:#999;
			span{
				margin-right:20px;
			}
		}
		div.details{
			margin-top:20px;
			font-size: 28px;
			line-height:50px;
			padding:0 40px;
			text-align: left;
			img{
				max-width:100%;
			}
		}
		.file-box{
			text-align: left;
			font-size:28px; /* px */
			padding:0 30px;
			margin-top:40px;
			margin-bottom:60px;
			h4{
				font-size:30px; /* px */
				line-height:60px;
			}
			a{
				height:50px;
				line-height:50px;
				display:block;
				color:#0099CC;
				text-decoration:underline;
			}
			
		}
	}
</style>
